﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Model;

namespace WebApplication.AppCode.View
{
    public class NodeView
    {
        public ProjectNode Node { get; set; }
        public List<PointContactsData> PointContacts { get; set; }
        public List<NodeInFilesView> InFiles { get; set; }
        public List<NodeOutFilesView> OutFiles { get; set; }
    }

    public class NodePointView : ProjectNodePoint
    {
        public string _state { get; set; }
        public int _uid { get; set; }

        public NodePointView() { }
        public NodePointView(ProjectNodePoint pnp)
        {
            this.ID = pnp.ID;
            this.Order = pnp.Order;
            this.PointID = pnp.PointID;
            this.PointItem = pnp.PointItem;
            this.ProjectNodeID = pnp.ProjectNodeID;
            this.ProjectNodeItem = pnp.ProjectNodeItem;
            this.Status = pnp.Status;
        }
    }

    public class PointContactsView : Contacts
    {
        public PointContactsView() { }
        public PointContactsView(NodePointContacts npc)
        {
            this.ContactID = npc.ContactID;
            this.NodePointID = npc.NodePointID;
            if (npc.ContactsItem != null)
            {
                this.Name = npc.ContactsItem.Name;
                this.RelatedParty = npc.ContactsItem.RelatedParty;
                this.Title = npc.ContactsItem.Title;
                this.PhoneNumber = npc.ContactsItem.PhoneNumber;
            }
        }
        public Guid NodePointID { get; set; }
        public Guid ContactID { get; set; }
        public string _state { get; set; }
        public int _uid { get; set; }
    }

    public class PointContactsData
    {
        public NodePointView Point { get; set; }
        public List<PointContactsView> Contacts { get; set; }
    }

    public class NodeInFilesView : NodeInFile
    {
        public string _state { get; set; }
        public int _uid { get; set; }
        public HttpPostedFile File { get; set; }
        public string Filename { get; set; }
    }

    public class NodeOutFilesView : NodeOutFile
    {
        public string _state { get; set; }
        public int _uid { get; set; }
        public HttpPostedFile File { get; set; }
        public string Filename { get; set; }
    }
}